//
//  DFProductsProductCell.m
//  cf
//
//  Created by lanou on 15/10/25.
//  Copyright © 2015年 xuzenghui. All rights reserved.
//

#import "DFProductsProductCell.h"
#import "UIImageView+WebCache.h"
@implementation DFProductsProductCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 15, 90, 70)];
        [self.contentView addSubview:_picImageView];
        
        _nameLab = [[UILabel alloc]initWithFrame:CGRectMake(110,5, kScreenWidth - 120, 40)];
        _nameLab.font = [UIFont systemFontOfSize:16];
        _nameLab.numberOfLines = 0;

        [self.contentView addSubview:_nameLab];
        
        _hitLab = [[UILabel alloc]initWithFrame:CGRectMake(110, 40, 120 , 30)];
        _hitLab.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_hitLab];
        
        _priceLab = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - 90, 40, 80, 30)];
        _priceLab.textColor = [UIColor colorWithRed:0.655 green:0.000 blue:0.007 alpha:1.000];
        _priceLab.textAlignment = NSTextAlignmentRight;
        _priceLab.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:_priceLab];
        
        _comStarLable = [[UILabel alloc]initWithFrame:CGRectMake(110, 75, 40, 20)];
        [self.contentView addSubview:_comStarLable];
        
        _comStarImageView = [[UIImageView alloc]initWithFrame:CGRectMake(145, 75, 20, 20)];
        [self.contentView addSubview:_comStarImageView];
        
        _reviewNumLab = [[UILabel alloc]initWithFrame:CGRectMake(170, 75, 60, 20)];
        _reviewNumLab.textColor = [UIColor grayColor];
        _reviewNumLab.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_reviewNumLab];
    }
    return self;
}

- (void)configureDataWith:(DFProductsProductMoel*)model
{
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    self.nameLab.text = model.name;
    self.hitLab.text =  [@"周关注量" stringByAppendingString:[model.thisWeekHit stringByAppendingString:@"次"]];
   
    self.priceLab.text = [@"￥" stringByAppendingString:model.price];
    if ([model.userCommStar intValue] > 0) {
    self.comStarImageView.image = [UIImage imageNamed:@"iconfont-ordinarywuxing"];
    self.comStarLable.text = [model.userCommStar stringByAppendingString:@"×"];
    }
    self.reviewNumLab.text = [model.reviewNum stringByAppendingString:@"点评"];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
